home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-20 | 50.9 KB | 1,722 lines |
- Newsgroups: comp.sources.misc
- From: tony@ajfcal.cuc.ab.ca (Tony Field)
- Subject: v27i097: psf3 - Postscript print filter system, v3, Part06/09
- Message-ID: <1992Jan21.013351.11634@sparky.imd.sterling.com>
- X-Md4-Signature: ca5cdb4bb5c66ea7608431b8a4949264
- Date: Tue, 21 Jan 1992 01:33:51 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: tony@ajfcal.cuc.ab.ca (Tony Field)
- Posting-number: Volume 27, Issue 97
- Archive-name: psf3/part06
- Environment: ISC, SUNOS, SYSVR3, DOS
- Supersedes: psf2: Volume 12, Issue 4-9
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 6 (of 9)."
- # Contents: Install.def Install.dos Install.unix Makefile table.c
- # Wrapped by ajf@trifid on Sat Jan 18 22:55:50 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Install.def' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Install.def'\"
- else
- echo shar: Extracting \"'Install.def'\" \(8808 characters\)
- sed "s/^X//" >'Install.def' <<'END_OF_FILE'
- X CONFIGURE PSF FOR AN "UNKNOWN" PRINTER
- X
- X Psf likes to have a "printer definition file" (usually
- X psfprint.def) to describe the fonts, imageable area, and paper
- X tray information needed by psf. If the .def information
- X is an accurate description of your printer, psf can do a
- X good job of page rotation, scaling, and double sided printing.
- X
- X Two way are available to create a .def for an unknown printer:
- X
- X
- X GET A COPY OF YOUR PRINTER'S .PPD FILE
- X ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- X If you can get a copy of your printer's ".ppd" file from the
- X Adobe server by email or from the manufacturer, you can use the
- X "table" programme to convert the .ppd information into a .def
- X format required by psf. The command:
- X
- X table printer.ppd /usr/tmp
- X
- X will read your file "printer.ppd" and create a file
- X /usr/tmp/printer.def. Copy this "printer.def" file to your psf
- X directory:
- X
- X cp /usr/tmp/printer.def psfprint.def
- X
- X Also, you should probably copy this file into ./defs for future
- X reference.
- X
- X
- X BUILD A .DEF FILE MANUALLY
- X ^^^^^^^^^^^^^^^^^^^^^^^^^^
- X If you have a printer that is not described when you execute
- X
- X selectdef ./defs/*.def
- X
- X all is not lost.
- X
- X Here is a summary of the steps:
- X
- X 1. copy getsizes.ps to your printer. This determines
- X the page sizes and imageable area on your printer.
- X
- X 2. copy ./defs/n890_470.def to psfprint.def.
- X
- X 3. edit psfprint.def to reflect the imageable area
- X and font name information for your printer.
- X
- X 4. all done - continue with "make installbsd"
- X or "make installsysv" as described in "Install.unix".
- X
- X In more detail:
- X
- X Generally, your printer is closely approximated by one of the
- X known printers. Guess at which one that might be! The best
- X guessing method is to look at your printer characteristics and
- X compare them to the various files in the ./defs directory :-)
- X
- X If you are really lost, then maybe psf's default printer (a NEC
- X LC890) is close enough to yours and you don't really need a
- X psfprint.def description file.
- X
- X With a little work, you can manually construct your own
- X psfprint.def. The basic items that you need to know are:
- X
- X 1. Which paper sizes can your printer handle
- X such as a4, letter, legal, etc? This can be
- X generated by "getsizes.ps".
- X
- X What is the postscript command needed to select
- X the paper size? Check you reference manual.
- X
- X 2. What is the imageable area of each paper size?
- X Each paper size has a specific x-y min and max that
- X can be addressed. The postscript programme
- X "getsizes.ps" can give you the imageable areas
- X for your printer.
- X
- X 3. Which fonts are available? Usually, you can
- X have the printer display all of it's known
- X fonts when you print the printers "test page".
- X Maybe it is in your manual.
- X
- X 4. How many paper trays are on your system and how
- X do you select them? This is usually in your
- X printer's technical reference manual.
- X
- X Determine the various available fonts from your printer's manual
- X or the built-in test page.
- X
- X Send the postscript programme "getsizes.ps" to your printer.
- X It will attempt to display the imageable area for all paper
- X sizes in your printer. Copy with a command like:
- X
- X 1. lp getsizes.ps
- X
- X 2. cat getsizes.ps > /dev/lp
- X
- X 3. or what ever, just get it to the printer.
- X
- X The resulting printed sizes are needed when you construct your
- X own psfprint.def file. The numbers that display are exactly
- X those required when you describe the "page dimensions" in the
- X .def file.
- X
- X Now copy a sample ".def" file to your working copy. Try to choose
- X one that might be an approximation to your own printer:
- X
- X cp ./defs/n890_470.def psfprint.def
- X
- X Using the example commented sample "def" file below, edit your
- X psfprint.def file to use your printer's appropriate information
- X for imageable area, font names and other parameters. Hopefully,
- X it is clear enough and you can just follow your intuition!
- X
- X=========================================================================
- X
- X This is a commented sample of a printer "def" file.
- X
- X You will need a list of available fonts and the printed results
- X from "getsizes.ps". Select a .def that is a "reasonable
- X approximation" to your printer. If you cannot find one,
- X use ./defs/n890_470.def.
- X
- X Look at other files in the ./defs directory to see how things
- X should be constructed. For example, if you have only one paper
- X tray, then you don't need "*slots" entries. i.e. your resulting
- X file would look like:
- X ...
- X *slots 0
- X *eof
- X
- X The various sections of the file are separated by a line
- X starting with "*". The first section describes the page sizes
- X known to the printer.
- X
- X There should not be any blank lines in your resulting .def
- X file. Line format must be exactly right. No edit checks
- X are performed by psf and friends.
- X--...--
- X
- X# comments at beginning of file
- X*psflpd <link> <opt> <opt> <comment> <-- option marker for lpd use only
- X (see Install.lpd for details)
- X This is not present for use with
- X lp/lpsched. Multiple lines
- X may be present.
- X
- X*printer <-- marker: printer definition
- XNEC LC-890 v47.0 (modified) <-- printer name for selectdef
- X
- X*paper 4 <-- marker and count of paper
- X types.
- X
- X next comes each paper size
- X available in your printer
- X in groups of three lines.
- X
- XLetter <-- The name use by psf when the
- X user selects a size with -g:
- X e.g. psf -g letter my.fil
- X ^^^^^^^^^
- Xstatusdict begin lettertray end <-- actual postscript to select size
- X code needed to select this
- X page size. If there is only
- X one paper tray, this is
- X usually a single word like
- X "letter" as in the file
- X ./defs/apple380.def or for
- X the Varityper printers.
- X Examine a few of these files
- X for the syntax of this line.
- X
- X the following is the imageable
- X area for the paper size. Use
- X the numbers that are printed
- X when you copy getsizes.ps or
- X psizes.ps to your printer.
- X 612 792 18 15 599 776
- X | | | | | +--------- upper right y-coord (points)
- X | | | | +--------------- upper right x-coord
- X | | | +-------------------- lower left y-coord
- X | | +-------------------------- lower left x-coord
- X | +--------------------------------- total page height in points
- X +--------------------------------------- total page width in points
- X (at least one blank must
- X separate the numbers)
- X
- X The first two numbers are
- X manually calculated in points
- X such that:
- X
- X points = 72 * inches
- X
- X for example, a 8.5 inch wide
- X page would be 612 points wide.
- X
- XLegal <-+-- the above is repeated for
- Xstatusdict begin legaltray end | each page size known
- X 612 1008 18 19 593 990 <-+-- to the printer
- XA4
- Xstatusdict begin a4tray end
- X 595 842 10 8 585 813
- XB5
- Xstatusdict begin b5tray end
- X 516 729 18 7 482 702
- X
- X*order 1 <-- marker and count for stacking order
- XNormal <-- either "Normal" if the pages are
- X stacked face down, or
- X "Reverse" if the pages are
- X stacked face up.
- X
- X*fonts 10 <-- marker and count for fonts
- XAvantGarde-Book <-- real font names in your printer
- XBookman-Light
- XCourier
- XHelvetica fonts available on your printer
- XHelvetica-Narrow are printed on it's test page
- XNewCenturySchlbk-Roman
- XPalatino-Roman only the "base font name", not
- XGaramond-Light the "italic" or "Bold" names
- XTimes-Roman are in this list.
- XZapfChancery-MediumItalic
- X
- X If you wish, modify psf.c
- X (array *fonts[NFONTS]) for
- X additional or different fonts
- X
- X*slots 2 <-- marker and count for paper trays
- X
- X Some printers number the
- X paper trays starting from 0
- X rather than 1 - for example,
- X the Dataproducts or TI printers.
- X
- X If you have only one paper tray,
- X this section should be empty.
- X
- Xstatusdict begin 1 setpapertray end <-- how to select first tray
- Xstatusdict begin 2 setpapertray end <-- how to select second tray etc..
- X*eof <-- logical eof for printer definition
- X
- X%%PsfStart <-- marker for language translation
- X%%fonX facilities. See language.PSF.
- X%%translate This section is optional.
- X%%PsfEnd
- X%postscript source
- X--------------------------------------------------------------------------
- XTony Field: tony@ajfcal.cuc.ab.ca
- END_OF_FILE
- if test 8808 -ne `wc -c <'Install.def'`; then
- echo shar: \"'Install.def'\" unpacked with wrong size!
- fi
- # end of 'Install.def'
- fi
- if test -f 'Install.dos' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Install.dos'\"
- else
- echo shar: Extracting \"'Install.dos'\" \(7837 characters\)
- sed "s/^X//" >'Install.dos' <<'END_OF_FILE'
- X PSF (v3) on MSDOS
- X ^^^^^^^^^^^^^^^^^
- X Pre-formatted documentation is available in the man/* directory.
- X
- X Modify the various options in the Makefile and/or psf.h.
- X
- X Compile the sources with MSC 5.1 (depending on your version of make,
- X utilities, cawf, etc).
- X
- X Sorry, no special setup for Turbo C! Since there is nothing "strange"
- X about the code, it should compile without problem.
- X
- X Source for getopt() is provided if your libraries do not have a copy.
- X
- X Read "Install.unix" and "Install.def" for additional information, if
- X desired.
- X
- X Build with:
- X make -f makefile.dos psf.exe
- X make -f makefile.dos psfbs.exe
- X make -f makefile.dos psfdoub,exe
- X make -f makefile.dos selectdef.exe
- X make -f makefile.dos printer
- X (or execute the batch script "getprint"
- X and proceed as described in the INSTALL
- X section below)
- X make -f makefile.dos doc (if you have cawf)
- X make -f makefile.dos installdos
- X
- X usage:
- X psf this.fil > prn
- X psfnroff -man psf.1
- X
- X If your version of make is incompatible with mine, you may have to
- X edit "psf.h" for system defaults and use your own method of building
- X the system using makefile.dos as a guide.
- X
- X The provided Makefile.dos (and psfnroff.bat) assumes that you have
- X "cawf" as an nroff replacement when you "make doc". If "cawf" is
- X not available, preformatted "*.doc" pages are provided.
- X
- X INSTALL
- X ^^^^^^^
- X 1. select a printer with:
- X
- X getprint
- X or:
- X selectde .\defs\*.def
- X
- X The various printer definitions are assumed to be in
- X the ".\defs" directory.
- X
- X If your printer is not defined in the table of known
- X printers, then choose the nearest approximation.
- X
- X If nothing is "close", then read "Install.def" to
- X construct your own "psfprint.def" file.
- X
- X A "psfprint.def" printer definition file is created
- X in the current directory.
- X
- X 2. copy the "psfprint.def generated in (1) above
- X to a "library" directory:
- X
- X copy psfprint.def c:\lib\psfprint.def
- X
- X 3. Set the environment variable PSFLP to define the printer:
- X
- X set PSFLP=prn
- X
- X If this variable is not set, then psf prints to stdout.
- X
- X 4. Set the environment variable PSFDEF to the location
- X of the "psfprint.def" file created in (1) above:
- X
- X set PSFDEF=c:\lib\psfprint.def
- X
- X If this variable is not set, then "psfprint.def" is assumed to
- X be in the directory specified in the makefile. If psfprint.def
- X does not exist, then psf defaults to work like a NEC LC890.
- X
- X 5. Move the binaries and batch scripts to an appropriate
- X directory:
- X
- X copy psf.exe c:\bin
- X copy psfbs.exe c:\bin --> optional
- X copy psfdoub.exe c:\bin --> optional
- X copy psfnroff.bat c:\bin --> optional
- X
- X Psfbs.exe and psfnroff.bat are needed only if nroff (cawf)
- X formatting is used.
- X
- X Psfdoub.exe is needed only if double sided or reverse page
- X order printing is used.
- X
- X If double sided printing is necessary on a regular basis,
- X modify the sample batch file "psdouble.bat" to suit
- X your requirements.
- X
- X Selectde.exe is used only for printer selection, and is
- X not usually copied to the binary working directory.
- X
- X 6. PSF can now be used: for example, print this "Install.dos"
- X file with:
- X
- X psf Install.dos
- X
- X 7. Print the doc pages. If the environment variable
- X PSFLP is not set, you must redirect stdout to prn.
- X If the PSFLP is set to 'prn', then the redirection
- X to prn is not needed.
- X
- X psf -R2 -r3 -2 psf.doc > prn
- X psf -R2 -r3 -2 psfbs.doc > prn
- X psf -R2 -r3 -2 psfdoub.doc > prn
- X psf -R2 -r3 -2 psfnroff.doc > prn
- X
- X This format assumes letter size paper. If other paper
- X sizes are used, try (untested):
- X
- X psf -l63 -c80 -R2 -r3 -2 psf.doc > prn
- X psf -l63 -c80 -R2 -r3 -2 psfbs.doc > prn
- X psf -l63 -c80 -R2 -r3 -2 psfdoub.doc > prn
- X psf -l63 -c80 -R2 -r3 -2 psfnroff.doc > prn
- X
- X 8. If psfnroff.bat is to be used, possibly change or remove
- X the print device "> prn". psfnroff.bat assumes that
- X "cawf" is used instead of "nroff".
- X
- X 9. Verify that the imageable area of your printer actually
- X corresponds to the printer definition that you selected during
- X the install process. Send the postscript file "psizes.ps" (or
- X getsizes.ps) to the line printer by some method:
- X
- X copy psizes.ps prn
- X -or-
- X copy getsizes.ps prn
- X
- X This programme prints the actual imageable area for each page
- X size known to your printer.
- X
- X The printed imageable area numbers should match the
- X corresponding numbers in psfprint.def. If they do not, edit
- X psfprint.def to use the printed numbers. (Even Adobe information
- X does not necessarily reflect the real nature of your printer. My
- X own Nec LC890 had a different letter imageable area than
- X indicated by the original .ppd file from Adobe...).
- X
- X Read "Install.def" if the editing process in not transparent!
- X
- X Copy the new psfprint.def file to it's target location as
- X set with "DEFFILE" in the Makefile.
- X
- X 10. Examine "Testfile". This file is an example of how escape
- X seqeuences can be imbedded in a text file to allow direct font
- X control within a text editor (See psf.1 for details).
- X [[ This file should contain CTL/characters.
- X If this test file is not in proper format, read the
- X notes in Install.unix to convert the necessary
- X control characters ]]
- X
- X After examining it, do the following:
- X
- X psf example > prn
- X
- X to see how font control can work in a text file.
- X
- X
- X MAN PAGES
- X ^^^^^^^^^
- X The man pages are all the "man/*.1" files. These may be formatted
- X with nroff or cawf. Man page installation must be done by hand.
- X Pre-formatted man pages are in man/*.doc.
- X
- X
- X AFTER INSTALLATION
- X ^^^^^^^^^^^^^^^^^^
- X 0. Print the man pages:
- X
- X psfnroff -man *.1
- X
- X 1. Verify that the imageable area of your printer actually
- X corresponds to the printer definition that you selected during
- X the install process. Send the postscript file "psizes.ps" (or
- X getsizes.ps) to the line printer by some method:
- X
- X copy psizes.ps prn
- X -or-
- X copy getsizes.ps prn
- X
- X This programme prints the actual imageable area for each page
- X size known to your printer.
- X
- X The printed imageable area numbers should match the corresponding
- X numbers in psfprint.def. If they do not, edit psfprint.def
- X to use the printed numbers. (Even Adobe information does not
- X necessarily reflect the real nature of your printer. My own
- X Nec LC890 had a different letter imageable area than indicated
- X by the original .ppd file from Adobe...).
- X
- X Read "Install.def" if the editing process in not transparent!
- X
- X Copy the new psfprint.def file to it's target location as
- X set with "DEFFILE" in the Makefile.
- X
- X 2. Examine "Testfile". This file is an example of how escape
- X seqeuences can be imbedded in a text file to allow direct font
- X control within a text editor (See psf.1 for details).
- X All of the "005" values must be edited to become a CLT/E
- X before the test will work correctly.
- X
- X After examining it, do the following:
- X
- X psf example > prn
- X
- X to see how font control can work in a text file.
- X
- X FILES NEEDED for DOS
- X ^^^^^^^^^^^^^^^^^^^^
- X The following files are needed for a dos source distribution:
- X
- X psf.c
- X psfbs.c
- X psfdoub.c
- X psf.h
- X ctp.h
- X patchlevel.h
- X psfproto.h
- X psfnroff.bat
- X getprint.bat
- X psdouble.bat
- X Install.dos
- X Install.def
- X Makefile.dos
- X NOTICE
- X README
- X testfile
- X getsizes.PS
- X selectdef.c
- X man/*.*
- X language.PSF
- X defs/*.def
- X ------------------------------------------
- X Tony Field: tony@ajfcal.cuc.ab.ca
- END_OF_FILE
- if test 7837 -ne `wc -c <'Install.dos'`; then
- echo shar: \"'Install.dos'\" unpacked with wrong size!
- fi
- # end of 'Install.dos'
- fi
- if test -f 'Install.unix' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Install.unix'\"
- else
- echo shar: Extracting \"'Install.unix'\" \(10693 characters\)
- sed "s/^X//" >'Install.unix' <<'END_OF_FILE'
- X P S F I N S T A L L A T I O N
- X =================================
- X
- X The following installation process should work with various forms
- X of unix using lpr/lpd and with System V r3 unix lp/lpsched
- X spoolers. The documented spooler installation process is not
- X compatible for System V r4: the printer spool scripts must be
- X manually installed (and possibly modified).
- X
- X If spooler support is installed, any file sent to the spooler
- X is examined: if the file is already in postscript form, then
- X the file is simply copied to the printer without any re-processing.
- X Only unprocessed text files will be filtered into postscript form.
- X As a result, 'any' file may be passed to the spooler for correct
- X processing. (If postscript sources is to be printed, the "-z"
- X option must be used for force the printing.)
- X
- X INSTALLATION
- X ^^^^^^^^^^^^
- X 1. Edit the Makefile, changing the various configuration parameters.
- X The general install steps are:
- X
- X make all
- X make printer
- X make scripts
- X make install
- X make installman (or installcat or installdoc)
- X
- X If nroff is not available, pre-formatted man pages are in
- X /man/*.doc.
- X
- X 2. Build the binaries with:
- X
- X make all
- X
- X 3. Select a printer:
- X
- X make printer
- X
- X If your printer is not specified, select the nearest
- X approximation and/or read the "Install.def" file.
- X
- X "make printer" can be run any number of times. It simply copies
- X your selected printer definition from the ./defs directory
- X to file "psfprint.def" in the current directory and generates
- X an associated "psizes.ps".
- X
- X If you are using a serial printer and using lp/lpsched, examine
- X the "stty" command to set port characteristics in psfunix.LP
- X (which is the prototype for the printer model "psf" when used
- X with lp/lpsched).
- X
- X 4. Make shell scripts:
- X
- X Some man systems may require additional options before the shell
- X script "psfman" can successfully process man pages through the
- X psf filters system. Examine and modify the file "psfman.SH" for
- X additional man options needed. On some systems, you man
- X need to specify the full path to the "man" programme and/or
- X force the option "-Tlp".
- X
- X Now build the shell scripts.
- X
- X make scripts
- X
- X (NOTE: script psfdouble is created as an example of setting
- X up a double sided print script, however is not
- X installed by any install process.)
- X
- X 5. Iff nroff is available, make nroff'd man pages. The resulting
- X *.doc files are written to the man/ directory.
- X
- X make doc
- X
- X If nroff is not available, pre-formatted documentation is
- X provided in various *.doc files. These may be moved to
- X the catman or man directories with "make installdoc". The
- X target directory for the preformatted pages is set in the
- X makefile (MANDIR).
- X
- X 6. A "user" installation copies only those modules that are
- X necessary for command line use. It does not copy spooler support
- X binaries and scripts.
- X
- X A "user" installation is complete after (as root):
- X
- X make installuser
- X
- X 7. A "full" installation copies all necessary spooler support
- X as well as user binaries and scripts to the target directories.
- X As root:
- X
- X make install
- X
- X 8. Install man pages if desired. Depending upon the type of system
- X being used, select from the following:
- X
- X make installman Install unformatted pages into the man
- X directory. This assumes that a complete
- X man system is available with nroff.
- X
- X make installcat Install formatted man pages into the
- X catman directory. Nroff must be available
- X to format the text.
- X
- X make installdoc Install pre-formatted man pages into
- X the catman (or selected man) directory.
- X This copies various *.doc files into
- X the catman directory: nroff is not needed.
- X
- X make doc Build .doc formatted files from .1
- X unformatted man page with nroff.
- X
- X 9. Three versions of psf are compiled by "make all":
- X
- X psf is normally used at the command line.
- X If the input is already in postscript, then it is
- X re-processed. I.e. you can print a postscript
- X programme. Input is accepted from stdin or from
- X file names.
- X
- X psffilter is used by the lp/lpsched spooling system.
- X It accepts input only on stdin and arguments
- X passed with the "-o" option. If the input is
- X already in postscript, the input is simply copied
- X to stdout (the printer). If the -v option
- X is used, postscript sources may be printed.
- X
- X psflpd is used by the lpr/lpd spooling system. It
- X accepts input only on stdin and cannot accept any
- X run-time arguments, not even those passed by lpd.
- X If the input is already in postscript, it is
- X simply copied to stdout (the printer). If
- X the -v option is used, postscript sources
- X may be printed.
- X
- X Printcap entries should use this binary or links
- X to this binary. If psflpd is executed with
- X different names, then different default page
- X conditions apply (see Install.lpd).
- X
- X Only the appropriate binary versions are copied with "make install".
- X
- X
- X CONFIGURE PRINTER (for lp/lpsched on SysV R3)
- X ^^^^^^^^^^^^^^^^^
- X The printer model defined for psf is copied during the install
- X process to:
- X
- X /usr/spool/lp/model/psf
- X
- X Printer installation is usually be done with lpadmin. If you
- X install the printer with lpadmin, be sure to specify the
- X "-m psf" option to select the psf printer model. E.g.:
- X
- X /usr/lib/lpadmin -p printer -v /dev/lp -m psf -o nobanner
- X
- X If you are using Interactive Unix 2.2, the you might wish
- X to use "sysadm lpmgmt". This can be done if you first
- X inform sysadm that psf exists:
- X
- X
- X edit /usr/admin/menu/packagemgmt/lpmgmt/lpsetup
- X - to have psf as a
- X valid printer choice.
- X
- X sysadm lpmgmt - add psf printer
- X
- X /usr/lib/lpadmin -d printer - set default printer
- X
- X enable printer.
- X
- X
- X CONFIGURE PRINTER (for lpr/lpd)
- X ^^^^^^^^^^^^^^^^^
- X After "make install" is completed, the printcap must be
- X configured. See "Install.lpd" for suggestions.
- X
- X
- X CONFIGURE PRINTER (for use with lp/lpsched over UUCP)
- X ^^^^^^^^^^^^^^^^^
- X A sample printer model "nlsdumb" is provided if you wish to use
- X remote printing over uucp (either by serial line or over the
- X tcp/ip+TLI interface). It must be manually installed if it is
- X needed.
- X
- X
- X MAN PAGES
- X ^^^^^^^^^
- X The man pages are all the man/*.1 files. These may be formatted
- X with nroff or cawf. Pre-formatted man pages are man/*.doc.
- X
- X
- X AFTER INSTALLATION
- X ^^^^^^^^^^^^^^^^^^
- X 0. Print the man pages:
- X
- X psfnroff -man *.1
- X
- X 1. Verify that the imageable area of your printer actually
- X corresponds to the printer definition that you selected during
- X the install process. Send the postscript file "psizes.ps" (or
- X getsizes.ps) to the line printer by some method:
- X
- X lp psizes.ps
- X -or-
- X cat getsizes.ps > /dev/lp
- X
- X This programme prints the actual imageable area for each page
- X size known to your printer.
- X
- X The printed imageable area (the last 4 numbers of each page
- X type) should match the corresponding numbers in psfprint.def. If
- X they do not, edit psfprint.def to use the printed numbers. (Even
- X Adobe information does not necessarily reflect the real nature
- X of your printer. My own Nec LC890 had a different letter
- X imageable area than indicated by the original .ppd file from
- X Adobe...).
- X
- X Read "Install.def" if the editing process in not transparent!
- X
- X Copy the new psfprint.def file to it's target location as
- X set with "DEFFILE" in the Makefile.
- X
- X 2. Edit the file "Testfile" with sed (as below). This file is an
- X example of how escape seqeuences can be imbedded in a text file
- X to allow direct font control within a text editor (See psf.1 for
- X details).
- X
- X The "Testfile" should contain many ^E characters (octal \005).
- X Since mail system may change the ^E character into the text
- X string "005" You will have to edit the testfile and replace all
- X "005" strings with true ctrl-E character.
- X
- X One easy way to correct this is with sed (Bourne shell only??)
- X
- X sed 's@005@<CTRL-E>@g' Testfile > example
- X +------+
- X actually type the CTRL-E character
- X to generate the octal charcter \005
- X
- X After editing, do the following:
- X
- X psf example | lp
- X
- X to see how font control can work in a text file.
- X
- X
- X LP OPTIONS (for lp/lpsched)
- X ^^^^^^^^^^
- X The provided printer model (/usr/spool/lp/model/psf and it's
- X associated prototype file psfunix.LP) allows the use of the "-o"
- X to pass options to psf. Two additional non-standard banner page
- X options may be passed to the printer script:
- X
- X banner = print banner page
- X nobanner = do not print banner page
- X
- X For example:
- X
- X lp -o"nobanner -4xh" my.text.file
- X lp -o"banner" another.file
- X
- X The psf printer model examines the printer configuration file
- X in:
- X
- X /usr/spool/lp/admins/lp/printers
- X /<printer name>/configuration
- X
- X to determine if banners are required. The first line of this
- X script normally contains one of the following (and can be set by
- X lpadmin):
- X
- X Banner: on:Always
- X Banner: on
- X
- X An additional option is recognized (and cannot be set by
- X lpadmin: it must be manually edited into the configuration
- X file):
- X
- X Banner: off
- X
- X "Banner: on:Always" forces banners to be printed, even if the
- X user specified "nobanner".
- X
- X "Banner: on" prints a banner page unless the user specifies
- X "nobanner". If "nobanner" is provided, then the banner is not
- X printed.
- X
- X "Banner: off" will not print the banner page unless the user
- X provides "banner", in which case the banner page is printed.
- X
- X
- X MULTIPLE PRINTERS
- X ^^^^^^^^^^^^^^^^^
- X If multiple different postscript printers are used with psf,
- X then either separate versions of psf and friends must be
- X constructed or the "-u alt.def" option of psf and psffilter
- X should be used. In any case, each back end printer script used
- X by lpsched, psnroff or psmbox must reference the appropriate
- X version of psf or have the -u option set.
- X
- X See Install.lpd for considerations when using lpr/lpd.
- X
- X Some provisions are in the Makefile to allow changes to the
- X target directories or the use of different binary programme
- X names.
- X
- X PSF notes.
- X ^^^^^^^^^^
- X The printer definitions in defs/* are derived from the Adobe
- X ".ppd" files. These are available from the Adobe file server via
- X email. The .ppd files describe each know printer characteristics
- X - but are not always perfectly accurate.
- X
- X The programme "table" is used to translate the ".ppd" files into
- X ".def" printer definition files used by psf. Documentation for
- X "table" is not provided - other than the comments in "table.c"
- X and a brief comment in Install.def.
- X
- X -------------------
- X Tony Field
- X (tony@ajfcal.cuc.ab.ca)
- END_OF_FILE
- if test 10693 -ne `wc -c <'Install.unix'`; then
- echo shar: \"'Install.unix'\" unpacked with wrong size!
- fi
- # end of 'Install.unix'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(10234 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X# $Id: Makefile,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X#
- X# Make the psf v3 postscript filter system
- X# ----------------------------------------
- X
- X# display all "make" options with:
- X#
- X# make
- X# or:
- X# make help
- X
- XSHELL = /bin/sh
- X
- X# - - - - Begin configuration - - - - -
- X#
- X# set compiler, tar and nroff names
- X
- X# CC=cc
- XCC = gcc
- X# CC=lpicc -sys -xid
- X
- X# TAR = tar
- XTAR = gtar
- X
- XNROFF = nroff
- X# NROFF = cawf
- X
- X# man directory (if you have man or catman directories)
- XMANDIR=/usr/man/manl
- X# MANDIR=/usr/man/man1
- X# MANDIR=/usr/catman/u_man/manl
- X# MANDIR=/usr/catman/u_man/man1
- X# MANDIR=/usr/man/man.1
- X
- X# If catman/formatted pages should be filtered with col
- X# COL=
- XCOL=| col -b
- X
- X# user print interface
- XUPRINT =lpr
- X# UPRINT =lp
- X
- X# Location of user binaries and scripts (for both lp/lpsched and lpr/lpd)
- XBINDIR=/usr/local/bin
- X# BINDIR=/local/bin
- X
- X# lpd filter directory (ignored for lp/lpsched)
- XLPDDIR=/usr/local/lib/psf
- X# LPDDIR=/local/lib/psf
- X
- X# Location of printer definition file (for lpr/lpd or lp/lpsched)
- XDEFFILE=/usr/local/lib/psf/psfprint.def
- X# DEFFILE=/local/lib/psf/psfprint.def
- X# DEFFILE=/usr/spool/lp/model/psfprint.def
- X
- X# Set the default paper type (letter, legal, a4, b5, etc.)
- XPSPTYPE = letter
- X
- X# if 2 paper trays, specifiy -DHOPPER for double sided printing.
- X# Second tray should be reserved for double sided printing only!
- X# TRAYS=
- XTRAYS=-DHOPPER
- X
- X# compile and library options
- XLDFLAGS = -lm
- XCFLAGS = -O $(NAMES) $(PAPTYPE) $(TRAYS) -DBINDIR=\"$(BINDIR)\" -DPDEF=\"$(DEFFILE)\"
- X
- X# extra things for SysV or Xenix with lp/lpsched
- XMODEL=/usr/spool/lp/model
- X
- X# if getopt isn't a standard part of your system
- X# GETOPT = getopt.o
- X
- X# -- usually, nothing below needs changing --
- X
- X# Names of executable binaries (See "Multiple printer support" in README)
- XPSF = psf
- XPSFDOUB = psfdoub
- XPSFBANNER = psfbanner
- XPSFFILTER = psffilter
- XPSFLPD = psflpd
- X
- XRCSVER = 3.2
- XRCSCOM="psf3, patch 2"
- X
- X# - - - - - end configuration - - - - - - - -
- X# ^^^^^^^^^^^^^^^^^
- X
- X# psf uses NAMES to find the current name of psfdoub
- X
- XNAMES = -DPSFDOUB=\"$(PSFDOUB)\"
- X
- XSOURCES = psf.c psfbs.c psfmail.c psfdoub.c psfbanner.c psdetect.c \
- X selectdef.c table.c psf.h psfproto.h ctp.h
- XOBJECTS = psf.o psfbs.o psfmail.o psfdoub.o psfbanner.o psdetect.o
- XBINARIES = $(PSF) psfbs psfmail $(PSFDOUB)
- XLPBIN = $(PSFBANNER) $(PSFFILTER)
- XLPDBIN = $(PSFLPD)
- XSCRIPTS = psfnroff psfman psfmbox
- XSUPPORT = selectdef table
- XOTHERS = Makefile README NOTICE Install.unix Install.lpd Install.def \
- X Testfile psfunix.LP getsizes.PS psfxenix.LP \
- X nlsdumb psfmbox.SH psfman.SH psfnroff.SH getopt.c Install.dos \
- X Changes Makefile.dos psfnroff.bat printcap.ETC \
- X psfdouble.SH psdouble.bat getprint.bat language.PSF psflpd.DEF \
- X printcap.NET
- XPATCHLEV = patchlevel.h
- XDOSSRC = psf.c psfbs.c psfdoub.c selectdef.c psf.h psfnroff.bat \
- X patchlevel.h getsizes.PS getopt.c getprint.bat psfproto.h ctp.h
- XDOSMAN = man/psf.1 man/psfbs.1 man/psfdoub.1 man/psfnroff.1
- XDOSDOC = man/psf.doc man/psfbs.doc man/psfdoub.doc man/psfnroff.doc
- XDOSOTHER = Makefile.dos NOTICE README Install.dos Install.def Testfile \
- X example psdouble.bat language.PSF
- X
- X
- XPTYPE = \"$(PSPTYPE)\"
- XPAPTYPE = -DPAPERTYPE=$(PTYPE)
- X
- X
- X
- X# make help
- X# ^^^^^^^^^
- Xhelp:
- X @echo " "
- X @echo "First: make the following in order"
- X @echo " 'make all' compile sources"
- X @echo " 'make printer' select a printer"
- X @echo " 'make scripts' tailor scripts"
- X @echo " "
- X @echo "Then: select one of the following installations"
- X @echo " 'make install' install all user and spooler files"
- X @echo " 'make installuser' install only user binaries and scripts"
- X @echo " 'make installbin' re-install binaries only after a source patch"
- X @echo " 'make installxenix' may work - no longer spported"
- X @echo " "
- X @echo "Others:"
- X @echo " 'make installman' install unformatted $(MANDIR) pages"
- X @echo " 'make installcat' format/install $(MANDIR) pages (needs nroff)"
- X @echo " 'make installdoc' install formatted $(MANDIR) pages (no nroff)"
- X @echo " 'make doc' generate formatted .doc from .1 pages (needs nroff)"
- X @echo " 'make tar' tar the original sources (/tmp/psf.tar)"
- X @echo " 'make dostar' tar things useful for dos (/tmp/psfdos.tar)"
- X @echo " 'make shar' make shar'ed kit for email"
- X @echo " 'make clean' remove anything that can be rebuilt"
- X
- X
- X
- X# Compile all sources
- X# ^^^^^^^
- Xall: $(BINARIES) $(LPBIN) $(LPDBIN) $(SUPPORT) getsizes.ps
- X
- X$(PSF): psf.c psf.h ctp.h $(GETOPT)
- X $(CC) $(CFLAGS) psf.c $(GETOPT) -o $(PSF) $(LDFLAGS)
- X
- X$(PSFDOUB): psfdoub.c psf.h $(GETOPT)
- X $(CC) $(CFLAGS) psfdoub.c $(GETOPT) -o $(PSFDOUB) $(LDFLAGS)
- X
- X$(PSFFILTER): psf.c psf.h $(GETOPT) ctp.h
- X $(CC) $(CFLAGS) -DPSFFILTER psf.c $(GETOPT) -o $(PSFFILTER) $(LDFLAGS)
- X
- X$(PSFLPD): psf.c $(GETOPT) ctp.h psf.h
- X $(CC) $(CFLAGS) -DFORLPD -DPSFFILTER $(GETOPT) psf.c -o $(PSFLPD) $(LDFLAGS)
- X
- X$(PSFBANNER): psfbanner.c psf.h ctp.h $(GETOPT)
- X $(CC) $(CFLAGS) psfbanner.c $(GETOPT) -o $(PSFBANNER) $(LDFLAGS)
- X
- Xpsfbs: psfbs.c psf.h $(GETOPT)
- X $(CC) $(CFLAGS) psfbs.c $(GETOPT) -o psfbs $(LDFLAGS)
- X
- Xpsfmail: psfmail.c psf.h $(GETOPT)
- X $(CC) $(CFLAGS) psfmail.c $(GETOPT) -o psfmail $(LDFLAGS)
- X
- Xselectdef: selectdef.c psf.h ctp.h $(GETOPT)
- X $(CC) $(CFLAGS) selectdef.c $(GETOPT) -o selectdef $(LDFLAGS)
- X
- Xtable: table.c psf.h $(GETOPT)
- X $(CC) $(CFLAGS) table.c $(GETOPT) -o table $(LDFLAGS)
- X
- Xgetsizes.ps:
- X sed "s@%letter@$(PSPTYPE)@g" getsizes.PS > getsizes.ps
- X
- X# make all scripts for both lpr and lp. install will use as needed
- X
- Xscripts:
- X sed "s@PRINTER@$(UPRINT)@g" psfmbox.SH > psfmbox
- X sed "s@PRINTER@$(UPRINT)@g" psfman.SH > psfman
- X sed "s@PRINTER@$(UPRINT)@g" psfnroff.SH > psfnroff
- X sed "s@PRINTER@$(UPRINT)@g" psfdouble.SH > psfdouble
- X sed "s@LPDFILTERS@$(LPDDIR)@g" printcap.ETC > printcap
- X sed "s@BINARY@$(BINDIR)@g" psfunix.LP \
- X | sed "s@PAGETYPE@$(PSPTYPE)@g" \
- X | sed "s@DEFFILE@$(DEFFILE)@g" > psf.model
- X chmod +x $(SCRIPTS) psf.model
- X
- X
- X# Create a printer selection
- X# ^^^^^^^^^^^^^^^^^^^^^^^^^^
- Xprinter:
- X selectdef defs/*.def
- X @test -r psfprint.def || ( echo "Error: cannot find psfprint.def" ; exit 1)
- X @chmod 644 psfprint.def
- X @if ( test $(UPRINT) = lpr ) then rm -f zz91 ; \
- X mv psfprint.def zz91 ; \
- X cat psflpd.DEF zz91 > psfprint.def ; \
- X rm zz91 ; fi
- X
- X# Install system
- X# ^^^^^^^^^^^^^^
- Xinstall:
- X @if ( test $(UPRINT) = lpr ) then make installbsd ; \
- X else make installsysv ; fi
- X
- Xinstallbsd:
- X @echo "Full installation for lpr/lpd spooler systems."
- X @test -r psfprint.def || ( make help ; exit 1)
- X @test -r psfmbox || ( make help ; exit 1)
- X @test -w $(LPDDIR) || ( echo Directory $(LPDDIR) not available ; exit 1)
- X @test -w $(BINDIR) || ( echo Directory $(BINDIR) not available ; exit 1)
- X strip $(LPDBIN) $(LPBIN) $(BINARIES) $(SUPPORT)
- X cp $(LPDBIN) $(LPDDIR)
- X cp $(BINARIES) $(SCRIPTS) $(BINDIR)
- X cp psfprint.def $(DEFFILE)
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/post
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/p2up
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/p4up
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/p132x60
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/paccount
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/psource
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/plegal
- X ln -f $(LPDDIR)/$(PSFLPD) $(LPDDIR)/pspread
- X
- Xinstallsysv:
- X @echo "Full installation for lp/lpsched spooler systems."
- X @test -r psfprint.def || ( make help ; exit 1)
- X @test -r psfmbox || ( make help ; exit 1)
- X @test -w $(BINDIR) || ( echo Directory $(BINDIR) not available ; exit 1)
- X cp psfprint.def $(DEFFILE)
- X cp psf.model $(MODEL)/psf
- X chown lp $(MODEL)/psf $(DEFFILE)
- X chgrp bin $(MODEL)/psf $(DEFFILE)
- X strip $(BINARIES) $(LPBIN) $(SUPPORT)
- X cp $(BINARIES) $(LPBIN) $(SCRIPTS) $(BINDIR)
- X
- Xinstalluser:
- X @echo "User binary and script installation. (Spooler support not installed.)"
- X @test -r psfprint.def || ( make help ; exit 1)
- X @test -r psfmbox || ( make help ; exit 1)
- X @test -w $(BINDIR) || ( echo Directory $(BINDIR) not available ; exit 1)
- X cp psfprint.def $(DEFFILE)
- X strip $(BINARIES) $(SUPPORT)
- X cp $(BINARIES) $(SCRIPTS) $(BINDIR)
- X
- Xinstallxenix: # SysV except for printer model details.
- X @echo "Full Xenix installation for lp/lpsched spooler systems."
- X @test -r psfprint.def || ( make help ; exit 1)
- X @test -r psfmbox || ( make help ; exit 1)
- X @test -w $(BINDIR) || ( echo Directory $(BINDIR) not available ; exit 1)
- X sed "s@BINARY@$(BINDIR)@g" psfxenix.LP \
- X | sed "s@PAGETYPE@$(PTYPE)@g" \
- X | sed "s@DEFFILE@$(DEFFILE)@g" > psf.model
- X chmod +x psf.model
- X cp psfprint.def $(DEFFILE)
- X cp psf.model $(MODEL)/psf
- X chown lp $(MODEL)/psf $(DEFFILE)
- X chgrp bin $(MODEL)/psf $(DEFFILE)
- X strip $(BINARIES) $(SUPPORT)
- X cp $(BINARIES) $(SCRIPTS) $(BINDIR)
- X
- Xinstallbin:
- X @echo "Binary re-install."
- X @test -w $(BINDIR) || ( echo Directory $(BINDIR) not available ; exit 1)
- X strip $(BINARIES)
- X cp $(BINARIES) $(BINDIR)
- X
- X
- X# Man page generation
- X# ^^^^^^^^^^^^^^^^^^^
- X
- Xinstallman:
- X cd man ; make installman MANDIR=$(MANDIR) NROFF=$(NROFF) COL="$(COL)"
- X
- Xinstallcat:
- X cd man ; make installcat MANDIR=$(MANDIR) NROFF=$(NROFF) COL="$(COL)"
- X
- Xinstalldoc:
- X cd man ; make installdoc MANDIR=$(MANDIR) NROFF=$(NROFF) COL="$(COL)"
- X
- Xdoc:
- X cd man ; make doc MANDIR=$(MANDIR) NROFF=$(NROFF) COL="$(COL)"
- X
- X# Copy distribution files
- X# ^^^^^^^^^^^^^^^^^^^^^^^
- Xtar:
- X $(TAR) cvf /tmp/psf.tar $(SOURCES) man $(OTHERS) defs Makefile.dis Makefile.ajf patchlevel.h
- X
- Xshar:
- X makekit -m -s54k defs man man/*.1 man/*.doc man/Makefile defs/* $(SOURCES) $(OTHERS) patchlevel.h
- X
- Xdostar:
- X $(TAR) cvf /tmp/psfdos.tar $(DOSSRC) $(DOSMAN) $(DOSDOC) $(DOSOTHER) defs
- X
- X
- X# Create .def files from .ppd
- X# ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- X
- Xdef:
- X table $$HOME/adobe/ppd/*.ppd defs
- X
- X# RCS checkin and out
- X# ^^^^^^^^^^^^^^^^^^^
- X
- Xci:
- X ci -r$(RCSVER) patchlevel.h
- X ci -r$(RCSVER) -m$(RCSCOM) $(SOURCES) $(OTHERS) Makefile.dis Makefile.ajf lines.c
- X
- Xciman:
- X cd man ; make ci RCSVER=$(RCSVER) RCSCOM=$(RCSCOM)
- X
- X
- Xco:
- X co -l $(SOURCES) $(OTHERS) Makefile.dis Makefile.ajf Makefile patchlevel.h lines.c
- X
- Xcoman:
- X cd man ; make co RCSVER=$(RCSVER)
- X
- X# Remove anything that cannot be rebuilt
- X# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Xclean:
- X rm -f $(BINARIES) $(SCRIPTS) $(SUPPORT) $(LPBIN) $(LPDBIN) psfdouble
- X rm -f *.o
- X rm -f *.B
- X rm -f *.doc
- X rm -f *~
- X rm -f psf.model getsizes.ps psfprint.def psizes.ps printcap
- X cd man ; make clean
- END_OF_FILE
- if test 10234 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'table.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'table.c'\"
- else
- echo shar: Extracting \"'table.c'\" \(9590 characters\)
- sed "s/^X//" >'table.c' <<'END_OF_FILE'
- X/* ta=4 */
- X/************************************************************************
- X* t a b l e . c *
- X* *
- X* Generate the *.def tables required by psf to describe a printer *
- X* *
- X* Scans the Adobe *.ppd files for specific parametric lines. *
- X* Tony FIeld, tony@ajfcal.cuc.ab.ca ` *
- X************************************************************************/
- X/*
- X * $Id: table.c,v 3.2 1992/01/19 05:50:33 ajf Exp ajf $
- X *
- X*/
- X
- X/* Usage: table files.ppd ... destination.dir
- X
- X where: files.ppd are the various .ppd files to be converted.
- X destination.dir is the destination directory in which
- X to place the generated .def file(s)
- X
- X The layout of the generated .def files is:
- X
- X*printer <-- marker
- XNEC LC-890 v47.0 (modified) <-- printer name for selectdef
- X (from *Nickname)
- XLetter <-- user name (e.g. psf -g Letter)
- X (from *PageSize)
- Xstatusdict begin lettertray end <-- actual postscript to select size
- X (from *PageSize)
- X 612 792 18 15 599 776 <-- page width page height LLx LLy URx URy
- X (page width/height from *PaperDimension)
- X (LLx LLy URx URy from *ImageableArea)
- XLegal
- Xstatusdict begin legaltray end
- X 612 1008 18 19 593 990
- XA4
- Xstatusdict begin a4tray end
- X 595 842 10 8 585 813
- XB5
- Xstatusdict begin b5tray end
- X 516 729 18 7 482 702
- X*order <-- marker for output order
- X from DefaultOutputOrder or
- X OutputOrder
- XNormal <-- default output order
- Xstatusdict begin 0 setoutputtray end <-- set to normal
- Xstatusdict begin 1 setoutputtray end <-- set to reverse
- X*fonts <-- marker for fonts
- XAvantGarde-Book <-- real font names in font dictionary
- XAvantGarde-Demi (from *Font)
- XBookman-Demi
- XBookman-Light
- XCourier
- XHelvetica
- XHelvetica-Narrow
- XNewCenturySchlbk-Roman
- XPalatino-Roman
- XSymbol
- XTimes-Roman
- XZapfChancery-MediumItalic
- XZapfDingbats
- X*slots <-- marker for paper tray select
- Xstatusdict begin 1 setpapertray end <-- select first tray
- Xstatusdict begin 2 setpapertray end <-- select second tray etc..
- X (from *InputSlot)
- X*eof <-- logical end of printer definition
- X*/
- X
- X#include <stdio.h>
- X#include <string.h>
- X#include <sys/types.h>
- X#include <sys/stat.h>
- X#include <ctype.h>
- X
- Xchar nickname[200];
- Xstruct pdef
- X{
- X char name[500];
- X char set[500];
- X char tray[500];
- X int lx, ly, ux, uy, sx, sy;
- X} ;
- X
- Xstruct outorder
- X{ char bydefault[100];
- X char normal[150];
- X char reverse[150];
- X} order;
- X
- Xchar *malloc();
- Xchar pname[100];
- Xstruct pdef printer[40], pblank;
- Xint nprinter = 0;
- Xchar *fonts[100];
- Xchar *slots[10];
- Xint nfonts=0;
- Xint nslots=0;
- Xvoid trim();
- X
- Xmain (argc,argv)
- Xint argc;
- Xchar *argv[];
- X{
- X char *fname;
- X FILE *fp_in, *fp_out;
- X int i, j;
- X char *c;
- X char outname[100], fnonly[50];
- X char *destdir;
- X
- X if (argc < 3)
- X usage ();
- X
- X argc--;
- X destdir = argv[argc];
- X if (isdir (destdir) != 1)
- X usage ();
- X
- X for (i = 1; i < argc; i++)
- X { if ((fp_in = fopen (argv[i], "r")) != NULL)
- X {
- X for (j = 0; j < nprinter; j++)
- X printer[j] = pblank;
- X
- X for (j = 0; j < nfonts; j++)
- X free (fonts[j]);
- X
- X for (j = 0; j < nslots; j++)
- X free (slots[j]);
- X
- X nfonts = nslots = nprinter = 0;
- X
- X fnameonly (argv[i], fnonly);
- X if ((c = strchr(fnonly, '.')))
- X *c = '\0';
- X strcpy (outname,destdir);
- X strcat (outname, "/");
- X strcat (outname, fnonly);
- X strcat (outname, ".def");
- X
- X if ((fp_out = fopen (outname, "w")) == NULL)
- X { fprintf (stderr, "%s: cannot create file %s\n", argv[0], outname);
- X exit (1);
- X }
- X build (fp_in);
- X display (fp_out);
- X fclose (fp_out);
- X
- X fclose (fp_in);
- X }
- X }
- X
- X}
- X
- Xbuild (fp_in)
- XFILE *fp_in;
- X{
- X char s[1000];
- X int n;
- X int a, b, c, d;
- X char which[500];
- X
- X order.bydefault[0] = 0;
- X order.normal[0] = 0;
- X order.reverse[0] = 0;
- X
- X while (fgets (s, 999, fp_in) != NULL)
- X { trim (s);
- X
- X if (strncmp (s, "*PageSize", 9) == 0)
- X {
- X n = ptype (s, which);
- X gettext (s, printer[n].set);
- X }
- X else if (strncmp (s, "*NickName:", 10) == 0)
- X {
- X gettext (s, nickname);
- X }
- X else if (strncmp (s, "*Font ", 6) == 0)
- X {
- X ftype (s);
- X }
- X else if (strncmp (s, "*DefaultOutputOrder:", 20) == 0)
- X { strcpy (order.bydefault, s + 21);
- X }
- X else if (strncmp (s, "*OutputOrder Normal:", 20) == 0)
- X {
- X gettext (s, order.normal);
- X }
- X else if (strncmp (s, "*OutputOrder Reverse:", 21) == 0)
- X {
- X gettext (s, order.reverse);
- X }
- X else if (strncmp (s, "*PaperTray", 10) == 0)
- X {
- X n = ptype (s, which);
- X gettext (s, printer[n].tray);
- X }
- X else if (strncmp (s, "*InputSlot", 10) == 0)
- X {
- X getmultitext (fp_in, s, which);
- X if (*which)
- X { slots[nslots] = malloc (strlen(which) + 2);
- X strcpy (slots[nslots], which);
- X nslots++;
- X }
- X }
- X else if (strncmp (s, "*ImageableArea", 14) == 0)
- X {
- X n = ptype (s, which);
- X sscanf (strchr (s, '"') + 1, "%d%d%d%d", &a, &b, &c, &d);
- X printer[n].lx = a;
- X printer[n].ly = b;
- X printer[n].ux = c;
- X printer[n].uy = d;
- X }
- X else if (strncmp (s, "*PaperDimension", 15) == 0)
- X {
- X n = ptype (s, which);
- X sscanf (strchr (s, '"') + 1, "%d %d", &a, &b);
- X printer[n].sx = a;
- X printer[n].sy = b;
- X }
- X }
- X}
- X
- X
- Xptype (s, which)
- Xchar *s, *which;
- X{
- X char *w, *ww;
- X int i;
- X
- X w = s;
- X while (*w++ != ' ')
- X ;
- X ww = which;
- X while (*w != ':')
- X {
- X if (*w == '/')
- X {
- X
- X while (*w++ != ':')
- X ;
- X break;
- X/*
- X ww = which;
- X w++;
- X continue;
- X*/
- X }
- X if (*w == ' ')
- X *w = '-';
- X *ww++ = *w++;
- X }
- X *ww = '\0';
- X while (*w == ' ')
- X w++;
- X/*
- X sscanf (s, "%*s%s", which);
- X*/
- X/*
- X w = which;
- X while (*w)
- X { if (*w == ':')
- X { *w = '\0';
- X break;
- X }
- X w++;
- X }
- X*/
- X for (i = 0; i < nprinter; i++)
- X { if (strcmp (which, printer[i].name) == 0)
- X return (i);
- X }
- X strcpy (printer[nprinter].name, which);
- X nprinter++;
- X return (nprinter - 1);
- X}
- X
- Xftype (s)
- Xchar *s;
- X{
- X char *w, *ww;
- X char which[100];
- X int i;
- X
- X w = s;
- X while (*w++ != ' ')
- X ;
- X ww = which;
- X while (*w != ':')
- X {
- X if (*w == ' ')
- X *w = '-';
- X *ww++ = *w++;
- X }
- X *ww = '\0';
- X while (*w == ' ')
- X w++;
- X
- X if (strncmp (which, "Za", 2))
- X { if (tscan (which, "Bold") >= 0 || tscan (which,"Italic") >= 0
- X || tscan (which,"Obliq") >= 0)
- X return;
- X }
- X
- X fonts[nfonts] = malloc (strlen (which) + 1);
- X strcpy (fonts[nfonts++], which);
- X
- X}
- X
- X
- Xdisplay (fp_out)
- XFILE *fp_out;
- X{
- X int i;
- X
- X fprintf (fp_out, "*printer\n");
- X fprintf (fp_out, "%s\n", nickname);
- X fprintf (fp_out, "*paper %d\n", nprinter);
- X for (i = 0; i < nprinter; i++)
- X {
- X fprintf (fp_out, "%s\n%s\n", printer[i].name, printer[i].set);
- X fprintf (fp_out, "%5d %5d %5d %5d %5d %5d\n",
- X printer[i].sx, printer[i].sy,
- X printer[i].lx, printer[i].ly, printer[i].ux, printer[i].uy);
- X
- X/* print the actual size of the image area
- X
- X printf ("%-20s %-20s %4d %4d\n", pname, printer[i].name,
- X printer[i].ux - printer[i].lx + 1,
- X printer[i].uy - printer[i].ly + 1);
- X*/
- X }
- X
- X
- X if (order.normal[0] || order.reverse[0])
- X fprintf (fp_out, "*order 3\n");
- X else
- X fprintf (fp_out, "*order 1\n");
- X fprintf (fp_out, "%s\n", order.bydefault);
- X if (order.normal[0] || order.reverse[0])
- X { fprintf (fp_out, "%s\n", order.normal);
- X fprintf (fp_out, "%s\n", order.reverse);
- X }
- X fprintf (fp_out, "*fonts %d\n", nfonts);
- X for (i = 0; i < nfonts; i++)
- X fprintf (fp_out, "%s\n", fonts[i]);
- X
- X fprintf (fp_out, "*slots %d\n", nslots);
- X for (i = 0; i < nslots; i++)
- X fprintf (fp_out, "%s\n", slots[i]);
- X fprintf (fp_out, "*eof\n");
- X}
- X
- Xgettext (s, t)
- Xchar *s, *t;
- X{
- X strcpy (t, strchr (s, '"') + 1);
- X while (*t)
- X { if (*t == '"')
- X { *t = '\0';
- X break;
- X }
- X t++;
- X }
- X}
- X
- Xgetmultitext (fp, s, t)
- XFILE *fp;
- Xchar *s, *t;
- X{ int eos;
- X char xlin[500], *c;
- X
- X eos = 0;
- X c = strchr (s, '"');
- X if (c == NULL)
- X { *t = 0;
- X return;
- X }
- X strcpy (t, c + 1);
- X while (eos == 0)
- X { while (*t)
- X { if (*t == '"')
- X { *t = '\0';
- X eos = 1;
- X break;
- X }
- X t++;
- X }
- X if (eos == 0)
- X { fgets (xlin, 499, fp);
- X trim (xlin);
- X c = xlin;
- X while (isspace (*c))
- X c++;
- X if (strlen (t))
- X strcat (t, " ");
- X strcat (t, c);
- X }
- X }
- X}
- X
- Xtscan (s, t)
- Xchar s[], t[];
- X{
- X int i, j, k;
- X for (i = 0; s[i] != '\0'; i++)
- X { for (j = i, k=0; t[k] != '\0' && s[j] == t[k]; j++, k++)
- X ;
- X if (t[k] == '\0')
- X return (i);
- X }
- X return (-1);
- X}
- X
- Xvoid trim (s) /* trim trailing blanks and \n */
- Xchar *s;
- X{ int many;
- X
- X for (many = strlen (s) - 1; many >= 0; many--)
- X { if (isgraph (s[many]))
- X break;
- X else
- X s[many] = '\0';
- X }
- X}
- X
- X
- X
- Xfnameonly (path, fn)
- Xchar *path, *fn;
- X{
- X char *strrchr(), *where;
- X
- X if ((where = strrchr (path, '/')) == NULL)
- X strcpy (fn, path);
- X else
- X strcpy (fn, where + 1);
- X return;
- X}
- X
- X
- X/****************************************************************************
- X* isdir (name) *
- X* See if the 'name' is a directory entry. If so, return 1. If not, *
- X* return a 0. *
- X****************************************************************************/
- X
- Xisdir (name)
- Xchar *name;
- X{
- X struct stat buf;
- X
- X if (stat (name, &buf) != 0) /* ensure stat() is happy */
- X return (-1);
- X if ((buf.st_mode & S_IFMT) == S_IFDIR) /* good call, see if */
- X return (1); /* is directory */
- X if ((buf.st_mode & S_IFMT) == S_IFREG) /* good call, see if */
- X return (0); /* is file */
- X return (-1); /* something else */
- X}
- X
- Xusage ()
- X{ fprintf (stderr, "Usage: table f.ppd f.ppd ... /dest.dir\n");
- X fprintf (stderr, " where f.ppd = source .ppd files\n");
- X fprintf (stderr, " dest.dir = desination directory for .def files\n");
- X exit (1);
- X}
- X
- END_OF_FILE
- if test 9590 -ne `wc -c <'table.c'`; then
- echo shar: \"'table.c'\" unpacked with wrong size!
- fi
- # end of 'table.c'
- fi
- echo shar: End of archive 6 \(of 9\).
- cp /dev/null ark6isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 9 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- exit 0 # Just in case...
-